<?php
class Action extends Template {
	public function upload() {
		$oItem = Base::loadClass ( 'Item', 'model' );
		parent::assign ( 'message', $oItem->upload ( $_FILES ['file'], $_POST ['uploadId'], $_GET ['type'] ) );
		parent::assign ( 'uploadId', $_POST ['uploadId'] );
		parent::assign ( 'action', '?a=item&m=add&type=' . $_GET ['type'] );
		parent::output ( 'uploadresult.html' );
	}
	
	public function add() {
		$oItem = Base::loadClass ( 'Item', 'model' );
		if ($_GET ['type'] == 'image') {
			$aUploadIds = explode ( ';', $_POST ['uploadId'] );
			$oItem->addImage ( $aUploadIds );
			parent::assign ( 'message', '添加图片成功' );
			parent::assign ( 'height', 80 );
			parent::output ( 'message.html' );
		}
	}
	
	public function edit() {
		$oItem = Base::loadClass ( 'Item', 'model' );
		echo intval($oItem->edit($_POST['id'], $_GET['type'], $_POST['value']));
	}
}
?>